package com.cm.sys.intermanager.utils;

import com.alibaba.fastjson.JSON;
import javax.websocket.EncodeException;
import javax.websocket.Encoder;
import javax.websocket.EndpointConfig;
import java.util.Map;

/**
 *@ClassNameLogEncoder
 *@Description 日志解码器，用于WebSocket的发送object请求，统一规范解码格式
 *@Author WZC
 *@Date2019/12/14 13:28
 *@Version V1.0
 **/
public class LogEncoder implements Encoder.Text<Map>{
    @Override
    public String encode(Map map) throws EncodeException {
        return JSON.toJSONString(map);
    }

    @Override
    public void init(EndpointConfig endpointConfig) {
        System.out.println("初始化encode");
    }

    @Override
    public void destroy() {
        System.out.println("销毁encode");
    }
}
